package com.bw.zg3park2212.user

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.LoginEntity
import com.bw.base.entity.RegiserEntity
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class UserViewModel @Inject constructor(val apiService: ApiService) :BaseViewModel() {
    var loginSuccse=MutableLiveData<LoginEntity>()
    fun login(username:String,password:String){
        httpRequst(
            { apiService.login(username, password)},
            loginSuccse::postValue
        )
    }
    val regiserSuccse=MutableLiveData<RegiserEntity>()
    fun regiser(username:String,password:String){
        httpRequst(
            {apiService.register(username, password)},
            regiserSuccse::postValue
        )
    }
}